<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let money = 1000 // 预存金额
 
        while (true) {
            let ps = +prompt(`
            请选择您的操作:
            1.取款
            2.存款
            3.查看余额
            4.退出
        `)
            // 用户输入4 退出循环
            if (ps === 4) {
                break
            }
            // 输入选项进行响应操作 switch
            switch (ps) {
                case 1:
                    let num1 = +prompt('取款：')
                    money -= num1
                    alert(`取款${num1}您的余额为${money}`)
                    break
                case 2:
                    let num2 = +prompt('存款：')
                    money += num2
                    alert(`存款${num2}您的余额为${money}`)
                    break
                case 3:
                    alert(`您的余额为${money}`)
                    break
            }
        }

    </script>
</body>
</html>